portal: Sent more data along
authorMatthias Clasen <mclasen@redhat.com>
Sat, 11 Jun 2016 05:30:50 +0000 (01:30 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 8 Jul 2016 04:07:59 +0000 (00:07 -0400)
Send the current_name, current_folder or current_file fields to
the portal.

https://bugzilla.gnome.org/show_bug.cgi?id=768499

gtk/gtkfilechoosernativeportal.c

index d0bd149e130fa221b201525e272f81d900763c0d..348c402bd7e7fb6ecce6640169153449d16ee224 100644 (file)
@@ -357,6 +357,27 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self)
   g_variant_builder_add (&opt_builder, "{sv}", "modal",
                          g_variant_new_boolean (data->modal));
   g_variant_builder_add (&opt_builder, "{sv}", "filters", get_filters (GTK_FILE_CHOOSER (self)));
+  if (GTK_FILE_CHOOSER_NATIVE (self)->current_name)
+    g_variant_builder_add (&opt_builder, "{sv}", "current_name",
+                           g_variant_new_string (GTK_FILE_CHOOSER_NATIVE (self)->current_name));
+  if (GTK_FILE_CHOOSER_NATIVE (self)->current_folder)
+    {
+      gchar *path;
+
+      path = g_file_get_path (GTK_FILE_CHOOSER_NATIVE (self)->current_folder);
+      g_variant_builder_add (&opt_builder, "{sv}", "current_folder",
+                             g_variant_new_bytestring (path));
+      g_free (path);
+    }
+  if (GTK_FILE_CHOOSER_NATIVE (self)->current_file)
+    {
+      gchar *path;
+
+      path = g_file_get_path (GTK_FILE_CHOOSER_NATIVE (self)->current_file);
+      g_variant_builder_add (&opt_builder, "{sv}", "current_file",
+                             g_variant_new_bytestring (path));
+      g_free (path);
+    }
 
   g_dbus_message_set_body (message,
                            g_variant_new ("(ss@a{sv})",